<?php
class IvaConditionsController extends AppController {  
	public $helpers = array('Html', 'Form', 'Session');
    public $components = array('Session');


    public function index() {
        $this->set('iva_conditions', $this->IvaCondition->find('all'));
    }
    
    public function view($id) {
    	$this->IvaCondition->id = $id;
    	$this->set('iva_condition', $this->IvaCondition->read());    
    }
    
    
    public function add() {
    	if ($this->request->is('post')) {
    		$this->IvaCondition->create();
    		if ($this->IvaCondition->save($this->request->data)) {
    			$this->Session->setFlash('Se han guardado los cambios.');
    			$this->redirect(array('action' => 'index'));
    		} else {
    			$this->Session->setFlash('No se pudieron guardar los cambios.');
    		}
    	}
    }
    
    public function edit($id = null) {
    	$this->IvaCondition->id = $id;
    	if ($this->request->is('get')) {
    		$this->request->data = $this->IvaCondition->read();
    	} else {
    		if ($this->IvaCondition->save($this->request->data)) {
    			$this->Session->setFlash('Datos actualizados correctamente.');
    			$this->redirect(array('action' => 'index'));
    		} else {
    			$this->Session->setFlash('No se pudieron guardar los cambios.');
    		}
    	}
    }

    }